﻿using System;
using System.Collections.Generic;
using UnityEngine;
using Yoozoo.Framework.Core;
using Yoozoo.Gta.Common;

namespace Gameplay.PVE.Survivor
{
    public class SurvivorDataManager: BattleSingleton<SurvivorDataManager>
    {
        private Dictionary<int,int> heroMap = new Dictionary<int, int>();


        public int dollar;
        public int dollarMax;
        
        public Dictionary<int,int> GetHeroes()
        {
            return heroMap;
        }
        
        public void Clear()
        {
            heroMap.Clear();
            dollar = 0;
        }

        public void AddHero(int index,int heroId)
        {
            heroMap[index] = heroId;
        }
        
        public void AddDollar(int value)
        {
            dollar += value;
            dollar = Mathf.Min(dollar, dollarMax);
            ResidentHandler.Inst.GetFunction("L_SurvivorManager.UpdateDollar").Action(value);
            MissionManager.Instance.OnGetDollar();
        }

        public void AddBuffsToTeam(List<int> element)
        {
            var group = StageManager.Instance.TeamGroup;
            group?.AddElements(element);
        }
    }
}
